/*
 * Copyright (c) 2015 www.smarthome.com All rights reserved.
 * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
 */
package com.smarthome.base.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.smarthome.base.dao.ShAccountDao;
import com.smarthome.base.dao.base.BaseDaoImpl;
import com.smarthome.domain.bean.ShAccount;

/**
 * ShAccountDao 实现类
 * @author KongXiangyu
 * @since 2015-09-07
 */
@Repository("shAccountDao")
public class ShAccountDaoImpl extends BaseDaoImpl<ShAccount,Long> implements ShAccountDao {
	private final static String NAMESPACE = "com.smarthome.base.dao.ShAccountDao.";
	
	//返回本DAO命名空间,并添加statement
	public String getNameSpace(String statement) {
		return NAMESPACE + statement;
	}

	@Override
	public long queryOnlineShAccountsCount(ShAccount account) {
		return this.select(getNameSpace("queryOnlineShAccountsCount"), account);
	}

	@Override
	public List<ShAccount> queryOnlineShAccounts(ShAccount account) {
		return this.selectList(getNameSpace("queryOnlineShAccounts"), account);
	}

	@Override
	public long queryShAccountsCount(ShAccount account) {
		return this.select(getNameSpace("queryShAccountsCount"), account);
	}

	@Override
	public List<ShAccount> queryShAccounts(ShAccount account) {
		return this.selectList(getNameSpace("queryShAccounts"), account);
	}

	@Override
	public List<ShAccount> selectShAccountByCon(ShAccount account) {
		return this.selectList(getNameSpace("selectEntryLs"), account);
	}

	@Override
	public Integer selectShAccountCountByCon(ShAccount account) {
		return this.select(getNameSpace("selectEntryLsCon"), account);
	}

	@Override
	public ShAccount selectShAccountById(Long id) {
		List<ShAccount> res= this.selectShAccountByIds(id);
		if(res != null&&res.size() >0){
			return res.get(0);
		}
		return null;
	}

	@Override
	public List<ShAccount> selectShAccountByIds(Long... ids) {
		return this.selectList(getNameSpace("selectEntryArr"), ids);
	}

	@Override
	public List<String> getShAccountIds(ShAccount account) {
		return this.selectList(getNameSpace("selectAccountIds"), account);
	}
		
}